//
//  XWViewController.m
//  XWCarouselPageView
//
//  Created by 1585519210@qq.com on 04/14/2017.
//  Copyright (c) 2017 1585519210@qq.com. All rights reserved.
//

#import "XWViewController.h"
#import <XWCarouselPageView/XWCarouselPageView.h>

@interface XWViewController ()
/** 轮播图 */
@property (nonatomic,strong)  XWCarouselPageView *myCarousePageView;
@property (weak, nonatomic) IBOutlet XWCarouselPageView *myCarousePageViewFromXib;

@end

@implementation XWViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.view addSubview:self.myCarousePageView];
    
    self.myCarousePageViewFromXib.imageArr = @[@"1",@"2",@"3",@"4"];
    self.myCarousePageViewFromXib.clickBlock= ^(NSInteger index) {
        NSLog(@"点击了%li",(long)index);
    };
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(XWCarouselPageView *)myCarousePageView{
    if (_myCarousePageView) {
        return _myCarousePageView;
    }
    else{
        _myCarousePageView = [XWCarouselPageView directWithFrame:CGRectMake(0, 64, self.view.frame.size.width, 180) ImageArr:@[@"1",@"2",@"3",@"4"] AndImageClickBlock:^(NSInteger index) {
            NSLog(@"点击了%li",(long)index);
        }];
        
        _myCarousePageView.carouselPageViewAlignment = XWCarouselPageViewAlignmentCenter;
        
        return _myCarousePageView;
    }
}
@end
